//引入vue
import Vue from 'vue'
//引入vue-router
import VueRouter from 'vue-router'

//引入路由组件
import Home from '@/pages/Home'
import Search from '@/pages/Search'
import Login from '@/pages/Login'
import Register from '@/pages/Register'

//使用vue-router
Vue.use(VueRouter)

//创建并暴露配置对象
export default new VueRouter({
    routes:[
        {
            name:'home',
            path:'/home',
            component:Home,
            //显示与否-元信息
            meta:{
                isShowFooter:true
            }
        },
        {
            name:'search',
            path:'/search/:keyword',
            component:Search,
            meta:{
                isShowFooter:true
            }
        },
        {
            name:'login',
            path:'/login',
            component:Login,
            meta:{
                isShowFooter:false
            }
        },
        {
            name:'register',
            path:'/register',
            component:Register,
            meta:{
                isShowFooter:false
            }
        },
        //重定向:刚进入页面时，跳转到home组件
        {
            path:'*',
            redirect:'/home'
        }
    ]
})